//
//  ZDOrder.m
//  特种车调度
//
//  Created by 陈宇 on 15/8/21.
//
//

#import "ZDOrder.h"

@implementation ZDOrder

+ (NSDictionary *)objectClassInArray{
    return @{@"orderLogs" : [OrderLog class]};
}

- (UIColor *)orderColor
{
    //    switch (_status) {
    //        case ZDOrderStatusRush:
    //            return BMColorFromRGB(0xFF42bfd0);
    //            break;
    //        case ZDOrderStatusWait:
    //            return BMColorFromRGB(0xFF9b9b9b);
    //            break;
    //        case ZDOrderStatusDoing:
    //            return BMColorFromRGB(0xFFc0a532);
    //            break;
    //        case ZDOrderStatusEnded:
    //            return BMColorFromRGB(0xFFfc7e6f);
    //        case ZDOrderStatusCancel:
    //            return BMColorFromRGB(0xFF9b9b9b);
    //            break;
    //        default:
    //            return [UIColor redColor];
    //            break;
    //    }
    return [UIColor redColor];
}

- (NSString *)orderTitle
{
    switch (_status) {
        case ZDOrderStatusRush:
            return @"抢单中";
            break;
        case ZDOrderStatusWait:
            return @"待开始";
            break;
        case ZDOrderStatusDoing:
            return @"进行中";
            break;
        case ZDOrderStatusEnded:
            return @"已完成";
        case ZDOrderStatusCancel:
            return @"已撤销";
            break;
        case ZDOrderStatusOffset:
            return @"已超时";
        default:
            return @"未知状态";
            break;
    }
}

- (void)setAppointmentTime:(NSString *)appointmentTime
{
    _name = appointmentTime;
    if ([BMUtils isEmptyString:appointmentTime]) {
        _appointmentTime = @"";
    }
    if (appointmentTime.length > 5) {
        _appointmentTime = [appointmentTime substringFromIndex:5];
    } else {
        _appointmentTime = appointmentTime;
    }
}

@end

@implementation OrderLog

+ (NSDictionary *)objectClassInArray
{
    return @{@"serviceLogs": [ServiceLog class]};
}

- (NSString *)getMsg
{
    NSString *tmp = @"";
    switch (_statusId) {
        case ZDOwnerStatusRush:
            tmp = @"司机还未开始";
            break;
        case ZDOwnerStatusRushSuccess:
            tmp = @"司机还未开始";
            break;
        case ZDOwnerStatusGP:
            tmp = @"司机改派中";
            break;
        case ZDOwnerStatusDZ:
            tmp = @"司机还未开始";
            break;
        case ZDOwnerStatusCancel:
            tmp = @"司机已取消";
            break;
        case ZDOwnerStatusServiceLog:
            tmp = @"司机工作中";
            break;
        case ZDOwnerStatusWaitSign:
            tmp = @"司机待签收";
            break;
        case ZDOwnerStatusWaitWind:
            tmp = @"司机待结算";
            break;
        case ZDOwnerStatusEnded:
            tmp = @"司机工作完成";
            break;
        case ZDOwnerStatusCommented:
            tmp = @"已评价";
            break;
        case ZDOwnerStatusCancel1:
            tmp = @"司机已取消";
            break;
        case ZDOwnerStatusCancel2:
            tmp = @"司机已取消";
            break;
        case ZDOwnerStatusRepeal:
            tmp = @"订单已撤销";
            break;
        case ZDOwnerStatusClose:
            tmp = @"订单已关闭";
            break;
        case ZDOwnerStatusUnEnd:
            tmp = @"未完成";
            break;
        case ZDOwnerStatusGPSuccess:
            tmp = @"改派成功";
            break;
    }
    return tmp;
}

+ (UIColor *)getStatusColor:(NSInteger)statusID
{
    //    int tmp = 0;
    //    switch (statusID) {
    //        case 1:
    //        case 2:
    //        case 3:
    //        case 4:
    //            tmp = 0xFF42bfd0;
    //            break;
    //        case 5:
    //            tmp = 0xFF9b9b9b;
    //            break;
    //        case 6:
    //        case 7:
    //        case 8:
    //        case 9:
    //        case 10:
    //            tmp = 0xFFfc7e6f;
    //            break;
    //        case 11:
    //        case 12:
    //        case 13:
    //        case 14:
    //            tmp = 0xFF9b9b9b;
    //            break;
    //    }
    //
    //    return BMColorFromRGB(tmp);
    return [UIColor redColor];
}

+ (NSString *)getStatusMsg:(ZDOwnerStatus)statusID
{
    NSString *tmp = @"";
    switch (statusID) {
        case ZDOwnerStatusRush:
            tmp = @"";
            break;
        case ZDOwnerStatusRushSuccess:
            tmp = @"抢单成功";
            break;
        case ZDOwnerStatusGP:
            tmp = @"订单改派中";
            break;
        case ZDOwnerStatusDZ:
            tmp = @"待开始";
            break;
        case ZDOwnerStatusCancel:
            tmp = @"订单已取消";
            break;
        case ZDOwnerStatusServiceLog:
            tmp = @"进行中";
            break;
        case ZDOwnerStatusWaitSign:
            tmp = @"待签收";
            break;
        case ZDOwnerStatusWaitWind:
            tmp = @"待结算";
            break;
        case ZDOwnerStatusEnded:
            tmp = @"已完成";
            break;
        case ZDOwnerStatusCommented:
            tmp = @"已评价";
            break;
        case ZDOwnerStatusCancel1:
            tmp = @"订单已取消";
            break;
        case ZDOwnerStatusCancel2:
            tmp = @"订单已取消";
            break;
        case ZDOwnerStatusRepeal:
            tmp = @"站点已撤销";
            break;
        case ZDOwnerStatusClose:
            tmp = @"订单已被关闭";
            break;
        case ZDOwnerStatusUnEnd:
            tmp = @"未完成";
            break;
        case ZDOwnerStatusGPSuccess:
            tmp = @"改派成功";
            break;
    }
    return tmp;
}

@end

@implementation ServiceLog

- (instancetype)init
{
    if (self = [super init]) {
        _agreeSignAll = YES;
    }
    return self;
}

+ (NSDictionary *)objectClassInArray
{
    return @{@"typeCharges": NSClassFromString(@"TypeCharge")};
}

@end

@implementation TypeCharge

@end


